package com.cj.DesignMode.iterator;

/**
 * 迭代器模式 用与迭代操作，方便按照顺序迭代
 */
public class IteratorPatternDemo {

    public static void main(String[] args) {
        NameRepository namesRepository = new NameRepository();

        for (Iterator iter = namesRepository.getIterator(); iter.hasNext(); ) {
            String name = (String) iter.next();
            System.out.println("Name : " + name);
        }

    }
}